package com.hu.boot.controller;

import com.hu.boot.entity.User;
import com.hu.boot.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UserController {

    private UserService userService;

    @Autowired
    public UserController(UserService userService) {
        this.userService = userService;
    }

    @RequestMapping("/find-all")
    public List<User> findAll(){
        return this.userService.findAll();
    }

    @RequestMapping("/save")
    public void save(User user){
        this.userService.save(user);
    }

}
